package d4l.ui;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;


public class TabbedPaneTest extends JPanel {

    public TabbedPaneTest() {
        setLayout(new BorderLayout());
        
        JTabbedPane pane = new JTabbedPane();
        
        JPanel buttonPanel = new JPanel(new GridLayout(5, 1));
        for (int i = 0; i < 5; i++)
            buttonPanel.add(new ToolTipButton("hello"));
        
        JPanel labelPanel = new JPanel(new GridLayout(5, 1));
        for (int i = 0; i < 5; i++)
            labelPanel.add(new JLabel("hello"));
        
        pane.addTab("Buttons", buttonPanel);
        pane.addTab("Labels", labelPanel);
        
        pane.setMnemonicAt(0, KeyEvent.VK_B);
        pane.setMnemonicAt(1, KeyEvent.VK_L);
        
        pane.setToolTipTextAt(0, "Play with buttons");
        pane.setToolTipTextAt(1, "Play with labels");
        
        pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        
        add(pane, BorderLayout.CENTER);
    }


    public static void main(String [] args) {
        JFrame frame = new JFrame("TabbedPaneTest");
        frame.setContentPane(new TabbedPaneTest());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }

}
